package com.kushe.entity;

import com.kushe.util.core.DbUtils;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.One;
import org.nutz.dao.entity.annotation.Table;

import java.util.Date;

/**
 * Created by WhiteBlue on 15/5/16.
 */

@Table("ks_reply")
public class Reply {

    @Id
    private int id;

    @Column
    private int from_id;

    @Column
    private int message_id;

    @Column
    private String content;

    @Column
    private Date time;

    @One(target = User.class, field = "from_id")
    private User from_user;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getFrom_id() {
        return from_id;
    }

    public void setFrom_id(int from_id) {
        this.from_id = from_id;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getMessage_id() {
        return message_id;
    }

    public void setMessage_id(int message_id) {
        this.message_id = message_id;
    }

    public User getFrom_user() {
        if (this.from_user == null) {
            DbUtils.getNutzDao().fetchLinks(this, "from_user");
            return this.from_user;
        } else
            return this.from_user;
    }

    public void setFrom_user(User from_user) {
        this.from_user = from_user;
    }
}
